//
//  UIFont+YSExtension.h
//  YSKitDemo
//
//  Created by Kyson on 2018/9/28.
//  Copyright © 2018 YangShen. All rights reserved.
//
/**
 *  由于苹方字体 iOS9.0+出现  需要做适配
 *  这个分类主要用来 字体...
 (
 "PingFangSC-Ultralight",
 "PingFangSC-Regular",
 "PingFangSC-Semibold",
 "PingFangSC-Thin",
 "PingFangSC-Light",
 "PingFangSC-Medium"
 )
 */

#import <UIKit/UIKit.h>

// IOS版本
#define YSIOSVersionForFont ([[[UIDevice currentDevice] systemVersion] floatValue])

/// 设置系统的字体大小（YES：粗体 NO：常规）
#define YSFont(__size__,__bold__) ((__bold__)?([UIFont boldSystemFontOfSize:__size__]):([UIFont systemFontOfSize:__size__]))

/// 极细体
#define YSUltralightFont(__size__) ((YSIOSVersionForFont<9.0)?YSFont(__size__ , YES):[UIFont ys_fontForPingFangSC_UltralightFontOfSize:__size__])

/// 纤细体
#define YSThinFont(__size__)       ((YSIOSVersionForFont<9.0)?YSFont(__size__ , YES):[UIFont ys_fontForPingFangSC_ThinFontOfSize:__size__])

/// 细体
#define YSLightFont(__size__)      ((YSIOSVersionForFont<9.0)?YSFont(__size__ , YES):[UIFont ys_fontForPingFangSC_LightFontOfSize:__size__])

// 中等
#define YSMediumFont(__size__)     ((YSIOSVersionForFont<9.0)?YSFont(__size__ , YES):[UIFont ys_fontForPingFangSC_MediumFontOfSize:__size__])

// 常规
#define YSRegularFont(__size__)    ((YSIOSVersionForFont<9.0)?YSFont(__size__ , NO):[UIFont ys_fontForPingFangSC_RegularFontOfSize:__size__])

/** 中粗体 */
#define YSSemiboldFont(__size__)   ((YSIOSVersionForFont<9.0)?YSFont(__size__ , YES):[UIFont ys_fontForPingFangSC_SemiboldFontOfSize:__size__])

/// 苹方常规字体 10
#define YSRegularFont_10 YSRegularFont(10.0f)
/// 苹方常规字体 11
#define YSRegularFont_11 YSRegularFont(11.0f)
/// 苹方常规字体 12
#define YSRegularFont_12 YSRegularFont(12.0f)
/// 苹方常规字体 13
#define YSRegularFont_13 YSRegularFont(13.0f)
/** 苹方常规字体 14 */
#define YSRegularFont_14 YSRegularFont(14.0f)
/// 苹方常规字体 15
#define YSRegularFont_15 YSRegularFont(15.0f)
/// 苹方常规字体 16
#define YSRegularFont_16 YSRegularFont(16.0f)
/// 苹方常规字体 17
#define YSRegularFont_17 YSRegularFont(17.0f)
/// 苹方常规字体 18
#define YSRegularFont_18 YSRegularFont(18.0f)
/// 苹方常规字体 19
#define YSRegularFont_19 YSRegularFont(19.0f)
/// 苹方常规字体 20
#define YSRegularFont_20 YSRegularFont(20.0f)

NS_ASSUME_NONNULL_BEGIN

@interface UIFont (YSExtension)

/**
 苹方极细体
 */
+ (instancetype)ys_fontForPingFangSC_UltralightFontOfSize:(CGFloat)fontSize;

/**
 苹方常规体
 */
+ (instancetype)ys_fontForPingFangSC_RegularFontOfSize:(CGFloat)fontSize;

/**
 苹方中粗体
 */
+ (instancetype)ys_fontForPingFangSC_SemiboldFontOfSize:(CGFloat)fontSize;

/**
 苹方纤细体
 */
+ (instancetype)ys_fontForPingFangSC_ThinFontOfSize:(CGFloat)fontSize;

/**
 苹方细体
 */
+ (instancetype)ys_fontForPingFangSC_LightFontOfSize:(CGFloat)fontSize;

/**
 苹方中黑体
 */
+ (instancetype)ys_fontForPingFangSC_MediumFontOfSize:(CGFloat)fontSize;

@end

NS_ASSUME_NONNULL_END
